#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time    : 2025/4/2 15:54
@Author  : HZP
@File    : test.py
"""
import base64
import secrets

from internal.model import Account
from pkg.password import hash_password
from internal.extension.database_extension import db
from flask_sqlalchemy import SQLAlchemy as _SQLAlchemy

def create_account():
   account= Account()
   account.name = "中电三公司智能语音"
   account.email = "1184647618@qq.com"
   account.phone = "15828679680"

   salt = secrets.token_bytes(16)
   password_salt=base64.b64encode(salt).decode()
   account.password_salt = password_salt

   password_hashed = hash_password("120823hu@", salt)
   base64_password_hashed = base64.b64encode(password_hashed).decode()

   account.password = base64_password_hashed
   db_data =_SQLAlchemy()
   db_data.session.add(account)
   db_data.session.commit()

create_account()